CC = g++ -Wall -std=c++0x -fPIC
RELEASE = 1
UNICODE = 0
LOADBIN = 
LIB = -ljsoncpp
LIBEX = -static-libgcc -lrt -ldl 
LOADSO = -Wl,-rpath=
LIBINCLUDE = LogicProtocol_CommPacket.o LogicProtocol_QueryPacket.o LogicProtocol_DllMain.o

ifeq ($(RELEASE),1)
FLAGS = -c -O2 
DEBUG = 
else
FLAGS = -c -lc_p
DEBUG = -g -pg 
endif

ifeq ($(UNICODE),1)
UNICODE = -D _UNICODE
else
UNICODE = 
endif

all:$(LIBINCLUDE)
	$(CC) $(DEBUG) $(LIBINCLUDE) -o libWINApt_LogicProtocol.so -shared -fPIC $(LOADBIN) $(LIB) $(LIBEX) $(LOADSO)

LogicProtocol_CommPacket.o:./LogicProtocol_CommPacket/LogicProtocol_CommPacket.cpp                 
	$(CC) $(DEBUG) $(FLAGS) $(UNICODE) ./LogicProtocol_CommPacket/LogicProtocol_CommPacket.cpp
LogicProtocol_QueryPacket.o:./LogicProtocol_QueryPacket/LogicProtocol_QueryPacket.cpp                 
	$(CC) $(DEBUG) $(FLAGS) $(UNICODE) ./LogicProtocol_QueryPacket/LogicProtocol_QueryPacket.cpp   
		
LogicProtocol_DllMain.o:LogicProtocol_DllMain.cpp             
	$(CC) $(DEBUG) $(FLAGS) $(UNICODE) LogicProtocol_DllMain.cpp


InstallAll:InstallSo 
InstallSo:./libWINApt_LogicProtocol.so 
	cp ./libWINApt_LogicProtocol.so ../../../WINApt_Release/WINApt_Logic/libWINApt_LogicProtocol.so



CleanAll:CleanObj CleanMk
CleanObj:
	rm *.o                                          
CleanMk:
	rm *.so                                        
